<template>
	<view  style="width: 50%;">
		<view class="tabbar">
			<view class="tabbar-item" :class="path==item.path ? 'active' : ''" v-for="(item, index) in datas" :key="index"  @click="$goto(item.path)">
				<view class="tabbar-item-icon">
					<image :src="path==item.path ? item.selected : item.pic"></image>
				</view>
				<view class="tabbar-item-text" :class="path==item.path ? 'active' : ''">{{item.name}}</view>
			</view>
		</view>
		<view style="width: 100%; height: 100rpx;"></view>
	</view>
</template>
 
<script>
	export default {
		props: {
			datas: Array
		},
		data() {
			return {
				path : ''
			}
		},
		mounted() {
			let pages = getCurrentPages()
			let currentPage = pages[pages.length - 1]
			this.path = '/'+currentPage.route
		},
		methods: {
		}
	}
</script>

<style lang='scss'>
	@keyframes fadeInUp {
		from {
			transform: translate3d(0, 100%, 0);
		}
		to {
			transform: none;
		}
	}
	.tabbar {
		width: 100%;
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		height: 100rpx;
		border-top: 0.5px solid #d5d5d5;
		display: flex;
		justify-content:space-around;
		align-items: center;
		font-size: 0;
		background: #fff;
		z-index: 999;
		animation-duration: 1s;
		animation-fill-mode: both;
		animation-name: fadeInUp;
	}
	.tabbar-item {
		text-align: center;
		overflow: hidden;
		box-sizing: border-box;
		padding: 10rpx;
		color: #888888;
		width:100%;
	}
	.tabbar-item-icon image {
		width: 56rpx;
		height: 56rpx;
	}
	.tabbar-item-text {
		font-size: 20rpx;
		line-height: 30rpx;
	}
	.tabbar-item.active {
		color: #45b984;
	}
</style>
